*** MATCHING *****
*** Set Working directory to JOP Replication files 

use "DATA FILES TO SHARE/match_w1.dta", clear

*** construct DID interaction term (migrant husband in wave 2 and year 1 will be = 0 ad others will be 0)
gen dummy = 0 
replace dummy = 1 if mig_husb == 1 & year == 1


 tab year w2_abshusband_dummy
 
 est clear
    foreach i in pol_score_norm dec_score_norm mob_score_norm GR_hh_cash {
 
 reghdfe `i' w2_abshusband_dummy i.year dummy, absorb(hhuid_num) vce(cluster vill_id_num)
 eststo match_indvfe_`i'
 }
 
 
 
 estout match_indvfe_*  using "OUTPUT/TABLES/Table_A10.tex", replace /// 
title("Dependent variable:") ///
    label  ///
    prehead("\begin{table}[H]" "\small" "\centering" "\caption{Male migration increases female autonomy}" ///
            "\begin{tabular}{lcccccccccc}" "\toprule" ///
            "&  \multicolumn{1}{c}{\textbf{Political Engagement}} & \multicolumn{1}{c}{\textbf{Bargaining Power}}& \multicolumn{1}{c}{\textbf{Mobility}} &\multicolumn{1}{c}{\textbf{Access to Cash}}\\" ///
            "&(1)&(2) & (3) & (4) \\" "\hline" "\hline") ///
    posthead("") keep( 1.year dummy) varlabels(  1.year "Wave 2" dummy  "Migrant Husband  $\times$ Wave 2") ///
	stats(r2_a N, fmt(%9.4f %9.0f) labels("Adj.R2" "Observations")) cells(b(fmt(a2) star) se(par fmt(a2))) starlevels(* 0.10 ** 0.05 *** 0.01) style(tex) collabels(, none) mlabels(, none) ///
    prefoot("\midrule"  "Individual FE & Yes & Yes & Yes & Yes\\"  " \midrule")   nonumber ///
     postfoot( "\bottomrule" "\end{tabular}" "\label{tab:matching}" "\begin{tablenotes}" ///
             "\noindent Notes: Estimates from a difference-in-difference specification using a matched sample. Matching is done on individual and village level covariates before migration i.e. in Wave 1 (\autoref{fig:psm_matching}). Each woman with a migrant husband is wave two is matched with five women with co-resident husbands. Since the sample here is limited to rural areas, I lose 1/3 of the treated units. I only consider cases where women can answer all questions within an index. During the analysis STATA dropped all singleton variables. All errors are clustered at the village level – primary sampling unit. Source: IHDS I and II." "\end{tablenotes}" "\end{table}")
